<?php

/**
 * Library :: DAL (Data Access Layer) :: DataObject
 *
 * Warlock is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 *
 * @package    warlock
 * @author     David Cole <neophyte@sourcetutor.com>
 * @license    GNU/GPL v2
 */

// Object Dependencies
using('Engine.DAL.DataObject');

class DAL_DataObject_newscategory extends DAL_DataObject
{
    function __construct()
    {
        parent::__construct();

        // Table Properties
        $this->Table      = 'w_ext_news_categories';
        $this->PrimaryKey = 'id';

        // Field Definitions
        $this->Fields['id']          = array('type' => 'INTEGER', 'size' => '3', 'unsigned' => true, 'autoincrement' => true);
        $this->Fields['title']       = array('type' => 'STRING', 'size' => '255');
        $this->Fields['description'] = array('type' => 'STRING', 'size' => 'MEDIUM');
        
        /*
         * Data Object Relationships
         */

        // Cascade Delete News Articles
        $this->Relationships[] = array('table'  => 'w_ext_news_articles',
                                       'do'     => 'newsarticle',
                                       'type'   => 'CASCADE',
                                       'relate' => array('id' => 'cid'));   
                                       
        // Cascade Delete                                        
        $this->Relationships[] = array('table'  => 'w_engine_node',
                                       'do'     => 'node',
                                       'type'   => 'CASCADE',
                                       'relate' => array('w_ext_news_articles.nid' => 'id'));                                              
    }
}

?>